#include<iostream>
#include<stack>
class A {
    public:
        int arr[10] = {1,2,3,4};
        std::stack<int>s;
        A(){
            s.push(1);
            s.push(2);
        }
        A(const A &copy_a){
            this->arr[0] = copy_a.arr[0] * 8;
            s.push(3);
            s.push(4);
        }
        A& operator=(const A &copy_a) {
            this->arr[0] = copy_a.s.top();
            s.push(5);
            s.push(6);
            return *this;
        }
        void print(){
            for(int i = 0;i<4;i++){
                std::cout<<this->arr[i]<<" ";
            }
            std::cout<<std::endl;
            std::cout<<"Top of stack : "<<this->s.top()<<std::endl;
            return;
        }
};
void func(A testA) {
    testA.arr[0] = 9;
    testA.s.push(3);
    testA.print();
}
int main() {
    A a1;
    a1.print();
    func(a1);
    a1.print();
    A a2(a1);
    a2.print();
    a2=a1;
    a2.print();
    return 0;
}